//
//  DXUserAccountModel.swift
//  新浪微博
//
//  Created by dix on 2017/2/4.
//  Copyright © 2017年 dix. All rights reserved.
//

import UIKit
//用户信息的模型
class DXUserAccountModel: NSObject,NSCoding {
    ///用户授权的唯一票据
    var access_token : String?
    ///access_token 的生命周期,单位是秒
    var expires_in : Double = 0{
        didSet{
            expires_Date = Date(timeIntervalSinceNow: expires_in)
        }
    }
    ///授权用户的UID
    var uid : String?
    ///用户昵称
    var screen_name : String?
    ///用户头像
    var avatar_large : String?
    //access_token过期时间
    var expires_Date : Date?
    
    override init() {
        super.init()
    }
    //归档
    func encode(with aCoder: NSCoder) {
        self.yy_modelEncode(with: aCoder)
    }
    // 解档
    required init?(coder aDecoder: NSCoder) {
        super.init()
        self.yy_modelInit(with: aDecoder)
    }

    //重写description
    override var description: String{
        let keys = ["access_token", "expires_in", "uid", "screen_name", "avatar_large"]
        return dictionaryWithValues(forKeys: keys).description
    }
    
}
